#include<stdio.h>

void exchange(int *p);

int main(void)
{
	int a[10] = { 1, 0, 4, 8, 12, 65, -76, 100, -45, 123 };
	int i, n = 10;
	int *p;

	p = a;
    //将a的地址传给p
	exchange(p);
    //p以实参传给函数

	for (i = 0; i <= 9; i++)
	{
		printf("%d ",a[i]);
	}
    //输出数组

	return 0;
}

void exchange(int *p)
{
	int i, j, temp;
	for (i = 0; i <= 9; i++)
	{
		for (j = i; j <= 9; j++)
		{
			if (p[i] >= p[j])
			{
				temp = p[j];
				p[j] = p[i];
				p[i] = temp;
			}
		}
	}
}

